<?php namespace addons\search\system;

//搜索标签
class Tag
{
	public function keyword($attr,$content)
	{
		$row = isset($attr['row']) ? $attr['row'] : -1;
		$str = <<<str
		<?php
		\$db = Db::table('addons_search')->orderBy('click','desc');
		if($row>0){
			\$db->limit($row);
		}
		\$data = \$db->get();
		foreach(\$data as \$field):
			\$field['url'] = __ROOT__ . '/search/' .  \$field['keyword'];
		?>
		$content
		<?php 
			endforeach;
		?>
str;
		return $str;
	}
}